package com.shujia.java.day18.demo9;

//这样写Join 程序一直在跑
//main一直在等待死亡 所以一直死不了

public class Demo1 {
    public static void main(String[] args) throws InterruptedException {
        //获取当前主线程
        Thread thread = Thread.currentThread();
        MyThreadDemo myThreadDemo = new MyThreadDemo();
        myThreadDemo.setName("张三");
        myThreadDemo.start();
        //stop
        for (int i = 0; i <100 ; i++) {
            if(i==45){
                thread.join();
            }
            System.out.println(thread.getName()+"------"+i);
        }
    }
}
